#ifndef _MCAS_SC_H
#define _MCAS_SC_H

#include <types.h>
#include <osal/osal.h>

#define SMC_DATA_MAX_LEN	256	// max. response length

#define SMC_CMD_LEN			5	// command length
#define SMC_CMD_INS_IDX		1	// INS index
#define SMC_CMD_DATALEN_IDX	4	// LEN index

#define SMC_CMD_SW_LEN	2	// status byte (SB) len
#define MAX_ATR_LEN		33	// max. ATR length
#define MAX_HIST_LEN		15	// max. number of historical characters

#define MCAS_CARD_MAX_NUM	2



typedef struct 
{
	UINT8 inited;
	UINT16 ca_system_id;
	struct smc_device *dev;
		
	BOOL (*sc_decoder)(struct smc_device *dev, UINT8 *ecm_data, UINT16 data_len,UINT8 *cw);
	BOOL (*sc_update)(struct smc_device *dev, UINT8 *emm_data, UINT16  data_len);
	BOOL (*sc_clear)(void);
} mcas_card_t;



BOOL mcas_card_exist();
void mcas_card_get_info(struct smc_device *smc_dev, mcas_card_t *card_info);
struct smc_device * mcas_card_match(UINT8 * ca_desc_data, UINT8 *card_inited);
INT32 mcas_card_in(UINT8 index, struct smc_device *smc_dev, UINT16 *ca_system_id);
BOOL mcas_card_out(struct smc_device *smc_dev);
BOOL mcas_card_decoder(struct smc_device *smc_dev, UINT8 *ecm_data, UINT16 data_len,UINT8 *cw);
BOOL mcas_card_update(struct smc_device *smc_dev, UINT8 *emm_data, UINT16 data_len);




/*smart card driver api can be found in smc.c

//for T0 protocal card, driver api to read and write data
//INT32  smc_iso_transfer(struct smc_device *dev, UINT8 *command, INT16 num_to_write, UINT8 *response, INT16 num_to_read, UINT8 status[2]);


//for other protocal card, driver api to read and write data
//INT32 smc_raw_read(struct smc_device *dev, UINT8 *buffer, INT16 size, INT16 *actlen);
//INT32 smc_raw_write(struct smc_device *dev, UINT8 *buffer, INT16 size, INT16 *actlen);


*/


#endif
